package com.bryantkobe.myspringcode.controller;

import com.bryantkobe.myspringcode.exception.ExceptionEnum;
import com.bryantkobe.myspringcode.exception.ResponseResult;
import com.bryantkobe.myspringcode.exception.SuccessResult;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @description: 异常断言Controller
 * @author: alienwarezzl
 * @date: 2025/9/23
 */
@RestController
@RequestMapping("/exceptionassert")
@Tag(name = "exceptionassert相关操作",description = "使用断言对异常进行处理进行相关操作")
public class ExceptionAssertController {

    private static final Logger log = LoggerFactory.getLogger(ExceptionAssertController.class);

    @Operation(summary = "testnull",description = "测试nullController")
    @GetMapping("/testnull")
    public ResponseResult testnull(String message){
        message = null;
        if (StringUtils.isBlank(message)){
            log.error("{}is blank", message);
        }

        //int i =1/0;

        ExceptionEnum.INVALID_PARAMETER.notNull(message,ExceptionEnum.INVALID_PARAMETER.getDefaultMessage());

        return SuccessResult.of(true);
    }
}
